package com.yoona.log.controller;

import com.yoona.common.response.BaseResponse;
import com.yoona.common.utils.PassTimeUtils;
import com.yoona.log.entity.SysLogs;
import com.yoona.log.mapper.SysLogsMapper;
import com.yoona.system.entity.Dynamic;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: yoonada
 * @email: m15602498163@163.com
 * @create: 2020-11-08 16:28
 * @description: 日志控制器
 */
@Api(tags = "日志控制器")
@CrossOrigin
@RestController
@RequestMapping("/log")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class LogController {

    private final SysLogsMapper sysLogsMapper;

    @GetMapping("/getLogsList")
    public BaseResponse<List<SysLogs>> getLogsList(@RequestParam(value = "currentPage", defaultValue = "1") Integer currentPage,
                                                   @RequestParam(value = "size", defaultValue = "5") Integer size) {
        List<SysLogs> logsList = sysLogsMapper.selectAllLogsByPage((currentPage - 1) * size, size);
        return BaseResponse.success(logsList, sysLogsMapper.selectAllLogsByCount());
    }
    
}
